package cn.tedu.hospitalgroupproject.server.content.service.impl;

import cn.tedu.hospitalgroupproject.server.content.dao.persist.repository.IHospitalNoticeRepository;
import cn.tedu.hospitalgroupproject.server.content.pojo.entity.HospitalNotice;
import cn.tedu.hospitalgroupproject.server.content.pojo.param.HospitalNoticeAddNewParam;
import cn.tedu.hospitalgroupproject.server.content.service.IHospitalNoticeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class HospitalNoticeServiceImpl implements IHospitalNoticeService {

    @Autowired
    private IHospitalNoticeRepository hospitalNoticeRepository;

    public HospitalNoticeServiceImpl() {
        log.info("创建医院公告对象:HospitalNoticeServiceImpl");
    }

    @Override
    public void addNew(HospitalNoticeAddNewParam hospitalNoticeAddNewParam) {
        log.debug("开始处理[新医院公告生]的业务,参数:{}",hospitalNoticeAddNewParam);

        HospitalNotice hospitalNotice=new HospitalNotice();
        BeanUtils.copyProperties(hospitalNoticeAddNewParam,hospitalNotice);

        hospitalNoticeRepository.insert(hospitalNotice);

    }
}
